class ArgvHandler(object):

    def __init__(self, argv):
        self.argv = argv
        self.call()

    def help_msg(self, error=''):
        msg = f"""
        %s
        run: 启动用户交互程序
        """
        exit(msg % error)

    def call(self):
        if len(self.argv) == 1:
            self.help_msg()
        if hasattr(self, self.argv[1]):
            getattr(self, self.argv[1])(self.argv[2:])
        else:
            self.help_msg(error='调用方法[%s]不存在' % self.argv[1])

    def run(self, *args, **kwargs):
        ssh_interactive.SshHandler(self)  # 开始交互
        pass
